package com.digital.welcome.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.digital.welcome.entity.UserRole;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 韩
 */

@Mapper
@Repository
public interface UserRoleMapper extends BaseMapper<UserRole> {

    List<String> getAllRoleByUserName(String username);

    List<UserRole> selectManager();

    @Select("SELECT * from user_role INNER JOIN role ON role.role_id=user_role.role_id limit #{offSet},#{pageSize}")
    List<UserRole> selectAllUserAndRoleName(int offSet,int pageSize);

    @Select("select * from user_role where user_name=#{username}")
    UserRole selectRoleByUserName(String username);
}
